package org.aepscolombia.platform.models.entity;
// Generated Jan 13, 2014 2:36:33 PM by Hibernate Tools 3.2.1.GA


import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * OrganicControls generated by hbm2java
 */
@Entity
@Table(name="organic_controls"
    ,catalog="madr_bd10"
)
public class OrganicControls  implements java.io.Serializable {


     private Integer idOrgCon;
     private TargetsTypes targetsTypes;
     private String nameOrgCon;
     private Set cropsTypeses = new HashSet(0);
     private Set controlses = new HashSet(0);

    public OrganicControls() {
    }

	
    public OrganicControls(TargetsTypes targetsTypes, String nameOrgCon) {
        this.targetsTypes = targetsTypes;
        this.nameOrgCon = nameOrgCon;
    }
    public OrganicControls(TargetsTypes targetsTypes, String nameOrgCon, Set cropsTypeses, Set controlses) {
       this.targetsTypes = targetsTypes;
       this.nameOrgCon = nameOrgCon;
       this.cropsTypeses = cropsTypeses;
       this.controlses = controlses;
    }
   
     @Id @GeneratedValue(strategy=IDENTITY)
    
    @Column(name="id_org_con", unique=true, nullable=false)
    public Integer getIdOrgCon() {
        return this.idOrgCon;
    }
    
    public void setIdOrgCon(Integer idOrgCon) {
        this.idOrgCon = idOrgCon;
    }
@ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="target_type_org_con", nullable=false)
    public TargetsTypes getTargetsTypes() {
        return this.targetsTypes;
    }
    
    public void setTargetsTypes(TargetsTypes targetsTypes) {
        this.targetsTypes = targetsTypes;
    }
    
    @Column(name="name_org_con", nullable=false, length=50)
    public String getNameOrgCon() {
        return this.nameOrgCon;
    }
    
    public void setNameOrgCon(String nameOrgCon) {
        this.nameOrgCon = nameOrgCon;
    }
@ManyToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY)
    @JoinTable(name="organic_controls_crops_types", catalog="madr_bd10", joinColumns = { 
        @JoinColumn(name="id_org_control_cro_typ", nullable=false, updatable=false) }, inverseJoinColumns = { 
        @JoinColumn(name="id_crop_type_cro_typ", nullable=false, updatable=false) })
    public Set getCropsTypeses() {
        return this.cropsTypeses;
    }
    
    public void setCropsTypeses(Set cropsTypeses) {
        this.cropsTypeses = cropsTypeses;
    }
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="organicControls")
    public Set getControlses() {
        return this.controlses;
    }
    
    public void setControlses(Set controlses) {
        this.controlses = controlses;
    }




}


